<script>
    function openDanwei(road_id)
    {
        var objId='shop';
        var layindex = layer.open({
            type:2,
            content:'{:url('zongtai/shop/sel')}'+'?obj='+objId,
            area:["60%","600px"],
        })
    }
    function openUser(userType)
    {
        var objId='user';
        var layindex = layer.open({
            type:2,
            content:'{:url('zongtai/user/sel')}'+'?userType='+userType+'&obj='+objId,
            area:["650px","500px"],
        })
    }
function exportcsv(id)
{
    var formdata=$(".layui-form").serialize();//Array();
    console.log(formdata)
    window.open("{:url('exportcsv')}?"+formdata)
    return
    $.post("{:url('exportcsv')}",formdata,function (res) {        
        console.log(res)
        if (res.code == 1) {
            layer.msg(res.msg, { icon: 1,time:1000 },function(){
                //location.href="{:url('index')}"
                //parent.location.reload();
            });
        }
        else {
            layer.msg(res.msg, { icon: 5 });
            return false;
        }
    });
}
  function saveimg(sn,img_url)
  {
    $.post("{:url('xadmin/upload/saveimg')}", { sn: sn, imgurl: img_url }, function (res) {
      console.log(res)

    })
  }
  function removeimg(obj)
{
    $(obj).remove();
    $.post("{:url('removeimg')}",{name:$(obj).attr('src')},function(){});
    regetimg()
}

function regetimg(imgId='images')
{
    var imgs_v='';
    var imgs=[];
    $(".upload-list").children().each(function(v){
        var img=$(this)[0]
        if($(this).is('img'))
        {
            var data_url=$(this).data('url')
            var imgpath =img.src;
            imgs.push(data_url);
        }
    })
    //console.log(imgs)
    
    if(imgs.length>0)
    {
        imgs_v=imgs.join(',');
    }
    $("input[name='"+imgId+"']").val(imgs_v);
}
function remove_img(obj) {
  $(obj).parent("div").remove();
  var formdata = { name: $(obj).prev().attr('src') };
  $.post("{:url('xadmin/upload/removeimg')}", formdata, function () { });
  regetimg()
}
function remove_img2(obj)
{                
    var obj_img=$(obj).siblings();
    $(obj).parent("div").remove();
    $.post("{:url('xadmin/upload/remove')}",{name:$(obj_img).attr('src')},function(){});
    regetimg()
}
function contains(arr,val)
{
    return arr.some(item=>item===val);
}
$(function(){
$("#think_page_trace_open").hide();    
})

</script>
</body>
</html>